import {Component} from 'react';
import {Redirect} from 'react-router-dom';

function WithLogin(WithComponent) {
    return class extends Component {
        render() {
            if(!localStorage.getItem('user')){
                return <Redirect from='/' to="/login"/>
            }
            return <WithComponent />
        }
    }
}

export default WithLogin;